/*我的待办item
* 图片+文字+小红点*/

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:frametrim/utility/sq_color.dart';
import 'package:badges/badges.dart';
class BlockLobView extends StatelessWidget {
  final String imgStr;
  final String name;
  final int redNum;
  final VoidCallback onPress;

  BlockLobView(this.imgStr, this.name, this.redNum, this.onPress);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onPress,
      child: Container(
          child: Badge(
            position: BadgePosition.topEnd(top: -10, end: -7),
            padding: EdgeInsets.all(6),
            //小红点内内容
            badgeContent:redNum!=0?Text('${redNum}', style: TextStyle(fontSize: 17, color: Colors.white),):null,
            //小红点颜色
            badgeColor: redNum!=0?SQColor.red:SQColor.trans,
            elevation: 0,
            //true时刷新时会在右则摆动一下
            // showBadge: false,
            child: Column(
              children: <Widget>[
                Image.asset(
                  imgStr,
                  width: 60,
                  height: 60,
                ),
                SizedBox(
                  height: 5,
                ),
                Text(
                  name,
                  style: TextStyle(fontSize: 14, color: SQColor.color_333333),
                ),

              ],
            ),
          ),
      ),
    );
  }
}
